<html>
<head>
<#import "/common/common.ftl" as netCommon>
<@netCommon.commonStyle />
<title></title>
<@netCommon.commonScript /> 
<@netCommon.commonLayui /> 
</head>
<body class="layui-layout-body show-scroll-y">
	<div class="layuimini-container">
		<form class="layui-form" lay-filter="editFrom" id="editFrom" action="">
			<input type="hidden" name="objectid" id="objectid" value="${objectid!}" />
			<div class="layui-form-item">
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-block layui-form">
					<input type="text" name="xm" lay-verify="required"
						placeholder="请输入"  class="layui-input" value="" />
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">身份证号</label>
				<div class="layui-input-block layui-form">
					 <input type="text" name="gmsfhm"
						placeholder="请输入"  class="layui-input" value="" />
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">性别</label>
				<div class="layui-input-block layui-form">
					 <input type="radio" name="xb" value="0" title="不详" checked="checked">
					 <input type="radio" name="xb" value="1" title="男" >
				     <input type="radio" name="xb" value="2" title="女">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">出生日期</label>
				<div class="layui-input-block layui-form">
					<input type="text" name="csrq" id="csrq" placeholder="年-月-日" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">所属单位</label>
				<div class="layui-input-block layui-form" lay-filter="ssjgFilter">
					<select name="ssjg" id="ssjg" lay-verify="required"  lay-search="">
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">人员状态</label>
				<div class="layui-input-block layui-form" lay-filter="daryztFilter">
					<select name="daryzt" id="daryzt"  lay-search="">
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">档案位置</label>
				<div class="layui-input-block layui-form"  lay-filter="ssdagFilter">
					<select name="ssdag" id="ssdag"  lay-verify="required" lay-search="">
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-block layui-form">
					<textarea placeholder="请输入内容" name="bz" class="layui-textarea"></textarea>
				</div>
			</div>
			<div class="layui-form-item line-center">
				<button type="submit" class="layui-btn" lay-submit lay-filter="saveBtn">保存</button>
				<button type="reset" class="layui-btn layui-btn-primary"  lay-filter="">重置</button>
			</div>
		</form>
	</div>
	<script type="text/javascript">
	layui.use(["form","layer","laydate"], function(){
		var layform = layui.form;
		var laydate = layui.laydate;
		zdCommon.initZdListOpts("#ssjg", "JGBM", "", true, function() {
			layform.render('select', 'ssjgFilter');
		});
		zdCommon.initZdListOpts("#daryzt", "RYZT", "", false, function() {
			layform.render('select', 'daryztFilter');
		});
		zdCommon.initZdListOpts("#ssdag", "ZWX", "", true, function() {
			layform.render('select', 'ssdagFilter');
		});
		laydate.render({
		    elem: '#csrq'
		 });
		$(function(){
			var objId = $("#objectid").val();
			if(objId){
				//获取实体属性对象数据
				$.ajax({
					url: basePath+"/ryda/detailByOid?objectid="+objId,
					type: "post",
					dataType: "json",
					async: false,
					success: function(data){
						layform.val('editFrom', {
							"objectid" : data.data.objectid,
							"xm" : data.data.xm,
							"xb" : data.data.xb,
							"csrq":dateFormat(data.data.csrq),
							"gmsfhm":data.data.gmsfhm,
							"ssjg":data.data.ssjg,
							"ssbm":data.data.ssbm,
							"bz":data.data.bz,
							"dqzt":data.data.dqzt,
							"ssdag":data.data.ssdag,
							"daryzt":data.data.daryzt
						});
					}
				});
			}
		});
		layform.on("submit(saveBtn)",function(){
			var pData = layform.val('editFrom');
			pData.csrq = parseDate(pData.csrq);
			$.ajax({
				url: basePath+"/ryda/doSave",
				type: "post",
				dataType: "json",
				data: pData,    
				success: function(res){
					showMsg.alert(res.msg,function(){
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
						parent.frames[0].loadStsxTable();
					});
				}
			});
			return false;
		});
	});
	</script>
</body>
</html>